/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package scanner;

/**
 *
 * @author Vlad
 */
public class ScannerError {

    public static final int NO_ERROR = 0;
    public static final int SCANNING_ERROR = 1;
    public static final int FILE_NOT_FOUND_ERROR = 2;
    private int errCode;
    private String msg;
    private int col;
    private int row;

    public ScannerError() {
        errCode = NO_ERROR;
        this.col = 0;
        this.row = 0;
    }

    public ScannerError(int errCode, String msg) {
        this.errCode = errCode;
        this.msg = msg;
    }

    public ScannerError(int errCode, String msg, int row, int col) {
        this.errCode = errCode;
        this.msg = msg;
        this.col = col;
        this.row = row;
    }

    public int getCol() {
        return col;
    }

    public int getErrCode() {
        return errCode;
    }
    
    public boolean hasErrors() {
    	return errCode != 0;
    }

    public String getMsg() {
        return msg;
    }

    public int getRow() {
        return row;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final ScannerError other = (ScannerError) obj;
        if (this.errCode != other.errCode) {
            return false;
        }
        return true;
    }

    @Override
    public int hashCode() {
        int hash = 3;
        hash = 37 * hash + this.errCode;
        return hash;
    }
}
